home *** CD-ROM | disk | FTP | other *** search
- #ifndef __LISTCONTROL__
- #define __LISTCONTROL__
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #ifndef __LISTS__
- #include <Lists.h>
- #endif
-
- #ifndef __WINDOWS__
- #include <Windows.h>
- #endif
-
- typedef void (*CLGetCompareDataProcPtr)(void *src, short srclen, void *dst, short *dstlen);
- typedef short (*CLDoCompareDataProcPtr)(void *ptra, void *ptrb, short lena, short lenb);
- typedef Boolean (*CLKeyFilterProcPtr)(ListHandle list, EventRecord *event);
-
- typedef struct CLDataRec {
- short mode;
- CLGetCompareDataProcPtr getCompareData;
- CLDoCompareDataProcPtr doCompareData;
- CLKeyFilterProcPtr keyFilter;
- } CLDataRec;
- typedef CLDataRec *CLDataPtr, **CLDataHndl;
-
- void CLActivate(Boolean makeActive, ListHandle listHndl);
- /*
- ** ¶ Change activate state of list control to designated state.
- **
- ** INPUT: aboveLayer This is the layer above the layer to create.
- ** INPUT: makeActive: true to make the control the active control.
- ** false to inactivate the control.
- ** listHndl: The list to activate or deactivate.
- **
- ** Activate this List record. Activation is not done by calling LActivate. The active
- ** control is indicated by the 2-pixel thick border around the List control. This allows
- ** all List controls in a window to display which cells are selected. This behavior can
- ** be overridden by calling LActivate on the List record for List controls.
- **
- ** Human interface dictates that at most only a single List control has this active border.
- ** For this reason, this function scans for other List controls in the window and removes
- ** the border from any other that it finds. */
-
- Boolean CLClick(WindowPtr window, EventRecord *event, short *action);
- /*
- ** ¶ Handle a mouseDown for a list control.
- **
- ** INPUT: window The window to check for a List control click in.
- ** event The mouseDown event.
- ** OUTPUT: action Pointer to a short to hold the resulting action.
- ** Pass in nil if you don't care.
- ** If 0 returned: No action taken.
- ** If 1 returned: The active list control used the click.
- ** If -1 returned: A new List control was activated
- ** (and the old one deactivated.)
- ** RESULT: Boolean True if a List control used the event.
- **
- ** This is called when a mouseDown occurs in the content of a window. It returns true if the
- ** mouseDown caused a List action to occur. Events that are handled include if the user
- ** clicks on a scrollbar that is associated with a List control. */
-
- ControlHandle CLCtlHit(void);
- /*
- ** ¶ Return List control that was found by last call to FindControl.
- **
- ** RESULT: ControlHandle
- **
- ** The List control that was hit by calling FindControl is saved in a global variable, since
- ** the CDEF has no way of returning what kind it was. To determine that it was a List control
- ** that was hit, first call this function. The first call returns the old value in the global
- ** variable, plus it resets the global to nil. Then call FindControl, and then call this
- ** function again. If it returns nil, then a List control wasn't hit. If it returns non-nil,
- ** then it was a List control that was hit, and specifically the one returned. */
-
- Boolean CLEvent(WindowPtr window, EventRecord *event, short *action);
- /*
- ** ¶ Handle the event if it applies to the active List control.
- **
- ** INPUT: window The window the event should be processed in.
- ** event The event to be processed.
- ** action: Used to return the action taken by CLClick.
- ** Pass in nil if you don't care.
- ** For click events:
- ** If 0 returned: No action taken.
- ** If 1 returned: The active list control used the click.
- ** If -1 returned: A new List control was activated
- ** (and the old one deactivated.)
- ** For key events:
- ** If 0 returned: No action taken.
- ** If 1 returned: Key positioning occured on the active control.
- **
- ** RESULT: Boolean True if a List control used the event.
- **
- ** Handle the event if it applies to the active List control. If some action occured due
- ** to the event, return true. */
-
- ListHandle CLFindActive(WindowPtr window);
- /*
- ** ¶ Returns the active List control, if any.
- **
- ** INPUT: window The window to check for an active List control.
- ** RESULT: ListHandle The active List control found (nil if none).
- **
- ** Returns the active List control, if any. If nil is passed in, then the return value
- ** represents whatever List control is active, independent of what window it is in. If a
- ** window is passed in, then it returns a List control only if the active control is in the
- ** specified window. If the active List control is in some other window, then nil
- ** is returned. */
-
- ControlHandle CLFindCtl(WindowPtr window, EventRecord *event, ListHandle *listHndl,
- ControlHandle *ctlHit);
- /*
- ** ¶ See if a List control or related scrollbar was clicked on.
- **
- ** INPUT: window The window to check for a hit.
- ** event The mouseDown event to hit-test with.
- ** OUTPUT: listHndl The list hit on, or nil if none hit.
- ** Pass in nil if you don’t care.
- ** ctlHit The control hit on, or nil if none hit.
- ** Pass in nil if you don’t care.
- ** (Note that the control returned here may be a related scrollbar.)
- ** RESULT: ControlHandle The List control hit, or nil for none.
- **
- ** This determines if a List control was clicked on, or if a related scrollbar was
- ** clicked on. If a List control or List scrollbar was clicked on, then true is returned,
- ** as well as the List handle and the handle to the view control. */
-
- ListHandle CLFromScroll(ControlHandle scrollCtl, ControlHandle *retCtl);
- /*
- ** ¶ Find the List record that is related to the indicated scrollbar.
- **
- ** INPUT: scrollCtl The scrollbar to look up.
- ** retCtl The List control handle. Pass in nil if you don’t care.
- ** RESULT: listHndl The list related to the scrollbar.
- **
- ** Find the List record that is related to the indicated scrollbar. */
-
- ListHandle CLGetList(WindowPtr window, short lnum);
- /*
- ** ¶ Get the Nth List control in the control list of a window.
- **
- ** INPUT: window The window whose control list is to be scanned.
- ** lnum The list number to return.
- ** RESULT: listHndl The Nth list control in the window list.
- **
- ** Get the Nth List control in the control list of a window. */
-
- short CLInsert(ListHandle listHndl, char *data, short dataLen, short row, short col);
- /*
- ** ¶ Insert a cell alphabetically into the list.
- **
- ** INPUT: listHndl The list to be inserted into.
- ** data Pointer to data to insert.
- ** dataLen Length of data to insert.
- ** row Row to insert into (or -1 if to be determined).
- ** col Column to insert into (or -1 if to be determined).
- ** RESULT: short The position at which the data was inserted.
- **
- ** Insert a cell alphabetically into the list. Whichever parameter is passed in as -1, either
- ** row or column, that is the dimension that is determined. The method of handling he
- ** comparisons has been changed to allow customization of the list data and search methods.
- ** Before, it was assumed that the cell content was text, and that the default LDEF was being
- ** used. If you write a custom LDEF that uses a different data format, you had problems before.
- ** Now, with the addition of two procedure pointers, you can customize the data comparisons.
- ** The two new procs are:
- ** 1) getCompareData
- ** 2) doCompareData
- ** The first proc, getCompareData, if nil, simply gets the data out of the cell for comparison
- ** purposes. If it is not nil, then the proc is called, and the proc gets the data out of the
- ** cell. The proc can then get whatever data it needs to for the purpose of comparing to other
- ** cells and finding the insert location in the list. The second proc, doCompareData, if nil
- ** tells the List control to call IUMagString for the purpose of comparison. If it is not nil,
- ** then the proc is called instead of IUMagString, and you can do whatever kind of comparison
- ** you wish. Your proc is a replacement for IUMagString, so it should be of that form, except
- ** that the prototype is a C prototype, instead of type pascal.
- **
- ** The prototypes are:
- **
- ** typedef void (*CLGetCompareDataProcPtr)(void *src, short srclen, void *dst, short *dstlen);
- ** typedef short (*CLDoCompareDataProcPtr)(void *ptra, void *ptrb, short lena, short lenb);
- **
- ** The GetCompareData proc is passed in a reference to the data, and a length. Its job is to
- ** then return the data and data length of what the compare data should look like.
- **
- ** The DoCompareData proc is just a replacement for IUMagString. Parameters are as expected.
- ** To set the procs, you first need to have a List control. The below example assumes that
- ** the window has a single List control.
- **
- **
- ** static short MyDoCompareData(void *ptra, void *ptrb, short lena, short lenb);
- ** static void MyGetCompareData(void *src, short srclen, void *dst, short *dstlen);
- ** static Boolean MyKeyFilter(ListHandle list, EventRecord *event);
- **
- ** ControlHandle ctl;
- ** ListHandle list;
- ** CLDataHndl listData;
- **
- ** ctl = CLNext(window, &list, nil, 1, false);
- ** listData = (CLDataHndl)(*ctl)->contrlData;
- ** (*listData)->getCompareData = MyGetCompareData;
- ** (*listData)->doCompareData = MyDoCompareData;
- ** (*listData)->keyFilter = MyKeyFilter;
- **
- ** The above code first gets the first (only) List control in window. It then gets
- ** the listData record so that it can store the compare procs into the list. The
- ** procs are then stored into the record.
- */
-
- Boolean CLKey(WindowPtr window, EventRecord *event);
- /*
- ** ¶ Handle a keypress for a list control.
- **
- ** INPUT: window The window to check for a List control keypress in.
- ** event The keypress event.
- ** RESULT: Boolean True if a List control used the event.
- **
- ** See if the keypress event applies to the List control, and if it does, handle it and
- ** return true. The keypress can only be used by the List control if the List control
- ** has key-positioning set. */
-
- ListHandle CLNew(short viewID, Boolean vis, Rect *vRect, short numRows, short numCols,
- short cellHeight, short cellWidth, short theLProc,
- WindowPtr window, short mode);
- /*
- ** ¶ Create a List control for the window.
- **
- ** This List control implementation does the following:
- **
- ** 1) Makes using lists in a non-dialog window easier.
- ** 2) The List is automatically associated with the window, since
- ** it is in the window's control list.
- ** 4) Updating of the List is much simpler, since all that is
- ** necessary is to draw the control (or all the window's controls with
- ** a DrawControls call).
- ** 5) What isn't handled automatically by tracking the control can be handled
- ** with a direct call. There are simple calls to handle List events.
- ** 6) When you close the window, the ListRecord is disposed of.
- ** (This automatic disposal can easily be defeated.)
- **
- ** To create a List control, you only need a single call. For example:
- **
- ** list = CLNew(rViewCtl, Resource ID of view control for List control.
- ** true, Initially visible.
- ** &viewRect, View rect of list.
- ** numRows, Number of rows to create List with.
- ** numCols, Number of columns to create List with.
- ** cellHeight,
- ** cellWidth,
- ** theLProc, Custom List procedure resource ID.
- ** window, Window to hold List control.
- ** clHScroll | blBrdr | clActive); Horizontal scrollbar, active List.
- **
- ** The various choices for the List control are defined as follows:
- **
- ** #define clHScroll 0x0002
- ** #define clVScroll 0x0008
- ** #define clActive 0x0020
- ** #define clShowActive 0x0040
- ** #define clKeyPos 0x0080
- ** #define clTwoStep 0x0100
- ** #define clHasGrow 0x0200
- ** #define clDrawIt 0x8000
- **
- ** clHScroll: Create a list that includes a horizontal scrollbar.
- ** clVScroll: Create a list that includes a vertical scrollbar.
- ** clActive: Make this the initially active control for the window.
- ** clShowActive: When the control is active, show that it is by drawing a selection
- ** border around the control. This is the new 7.0 human-interface
- ** method of showing which control is active. (It also works in system 6.)
- ** clKeyPos: Allow list positioning, based on user keypresses. This assumes that
- ** the list is alphabetized so that key presses for location make sense.
- ** If typing by the user is fast enough, multiple characters will be
- ** used for the positioning.
- ** clTwoStep: When using IsCtlEvent(), you may want the initial click on a List
- ** control to just select the control, or you may wish the click to start
- ** tracking in addition to selecting the control. The tracking is
- ** considered the second step. By setting this bit, you indicate that you
- ** want control selection and item selection to be a 2-step process.
- ** Setting this bit means that it will take 2 separate clicks by the
- ** user to select an item in the list if the list is inactive.
- ** clHasGrow: This makes sure that there is space for the growIcon if the list
- ** has a scrollbar. If the list occupies an entire window, then if there
- ** is only one scrollbar, the scrollbar has to be shrunk to make room
- ** for the growIcon. The List Manager supposedly has this ability, but
- ** it doesn't work. The List control manages it correctly.
- ** clDrawIt: This is a List manager flag that is needed for the LNew() call.
- **
- **
- ** If the CLNew call succeeds, you then have a List control in your window. It will be
- ** automatically disposed of when you close the window. If you don't want this to happen,
- ** then you can detach it from the view control which owns it. To do this, you would to
- ** the following:
- **
- ** viewCtl = CLViewFromList(theListHndl);
- ** if (viewCtl) SetCRefCon(viewCtl, nil);
- **
- ** The view control keeps a reference to the List record in the refCon. If the refCon is
- ** cleared, then the view control does nothing. So, all that is needed to detach a List
- ** record from a view control is to set the view control's refCon nil. Now if you close the
- ** window, you will still have the List record.
- **
- **
- ** To remove a List control completely from a window, just dispose of the view
- ** control that holds the List record. To do this, just do something like the below:
- **
- ** DisposeControl(CLViewFromList(theListHndl));
- **
- ** This completely disposes of the List control.
- **
- **
- ** Events for the List record are handled nearly automatically. Just make the following call:
- **
- ** CLEvent(window, eventPtr, &action);
- **
- ** If the event was handled, true is returned. If the event is false, then the event doesn't
- ** belong to a List control, and further processing of the event should be done.
- */
-
- ControlHandle CLNext(WindowPtr window, ListHandle *listHndl, ControlHandle ctl,
- short dir, Boolean justActive);
- /*
- ** ¶ Get the next List control in the window.
- **
- ** INPUT: window The window to check for a List control keypress in.
- ** ctl The last control found (nil searchs from beginning of control list).
- ** dir Search direction (1 for forward, -1 for backward).
- ** justActive True if only active, visible controls should be returned.
- ** RESULT: ControlHandle Next control found, based on criteria.
- **
- ** Get the next List control in the window. You pass it a control handle for the view control,
- ** or nil to start at the beginning of the window. It returns both a List handle and the view
- ** control handle for that List record. If none is found, nil is returned. This allows you to
- ** repeatedly call this function and walk through all the List controls in a window. */
-
- void CLPrint(RgnHandle clipRgn, ListHandle listHndl, short *row, short *col,
- short leftEdge, Rect *drawRct);
- /*
- ** ¶ Print List Control cells into the designated rectangle.
- **
- ** INPUT: clipRgn Region to clip output to.
- ** listHndl List to print.
- ** leftEdge Don’t print cells left of this column.
- ** IN/OUT row Starting row to print (first row not printed returned here).
- ** col Starting column to print (first column not printed returned here).
- ** drawRct Print cells inside rect. Rect is also shrunk to bound the
- ** cells that did print.
- **
- ** From the starting row or column, print as many cells as will fit into the designated rect.
- ** Pass in a starting row and column, and they will be adjusted to indicate the first cell
- ** that didn't fit into the rect. If all remaining cells were printed, the row is returned
- ** as -1. The bottom of the rect to print in is also adjusted to indicate where the actual
- ** cut-off point was. */
-
- short CLRowOrColSearch(ListHandle listHndl, void *data, short dataLen,
- short row, short col);
- /*
- ** ¶ Find the location in the list where the data would belong if inserted.
- **
- ** INPUT: listHndl List to search.
- ** data Pointer to data to search for, of whatever type.
- ** dataLen Length of data to search for.
- ** row Row to restrict search to, or -1 if doing row search.
- ** col Column to restrict search to, or -1 if doing column search.
- ** RESULT: short Insertion location for either row or column.
- **
- ** Find the location in the list where the data would belong if inserted. The row and column
- ** are passed in. If either is -1, that is the dimension that will be determined and returned.
- ** The two comparison procs getCompareData and doCompareData are used in this function.
- **
- ** __________
- **
- ** Also see: CLInsert. */
-
- void CLUpdate(RgnHandle clipRgn, ListHandle list);
- /*
- ** ¶ Draw the List control in the correct mode.
- **
- ** INPUT: clipRgn Draw only within this region.
- ** list List to draw.
- **
- ** Draw the List control in the correct mode. */
-
- ControlHandle CLViewFromList(ListHandle listHndl);
- /*
- ** ¶ Given a list, return the related wrapper control.
- **
- ** INPUT: listHndl List assumably wrapped by a control.
- ** RESULT: ControlHandle Control wrapping list (or nil if none).
- **
- ** Return the control handle for the view control that owns the List record. Use this to find
- ** the view to do customizations such as changing the update procedure for this List control. */
-
- ListHandle CLWindActivate(WindowPtr window, Boolean displayIt);
- /*
- ** ¶ Given a list, return the related wrapper control.
- **
- ** INPUT: listHndl List assumably wrapped by a control.
- ** RESULT: ControlHandle Control wrapping list (or nil if none).
- **
- ** This window is becoming active or inactive. The borders of the List controls need to be
- ** redrawn due to this. For each List control in the window, redraw the active border. */
-
- void CLSize(ListHandle list, short newH, short newV);
- /*
- ** ¶ Resize the control and related things.
- **
- ** INPUT: list List to resize.
- ** newH New width for control.
- ** newV New height for control.
- **
- ** This resizes the list and it's viewCtl All parts are resized, including the scrollbars,
- ** and active indicator. */
-
- void CLMove(ListHandle list, short newH, short newV);
- /*
- ** ¶ Move the control and related things.
- **
- ** INPUT: list List to move.
- ** newH New horizontal location for control.
- ** newV New vertical location for control.
- **
- ** This moves the list and it's viewCtl All parts are moved, including the scrollbars,
- ** and active indicator. */
-
- void CLShow(ListHandle list);
- /*
- ** ¶ Show the control and related things.
- **
- ** INPUT: list List to show.
- **
- ** This shows the list and related parts, including the scrollbars and active indicator. */
-
- Rect CLHide(ListHandle list);
- /*
- ** ¶ Hide the control and related things.
- **
- ** INPUT: list List to hide.
- **
- ** This hides the list and related parts, including the scrollbars and active indicator. */
-
- void CLVInitialize(void);
- /*
- ** ¶ Initialize variable-sized cells List control code.
- **
- ** Call this upon startup of any application that wants to be able to use the
- ** variable-size cell feature of the List control. For AppsToGo-created List control
- ** definitions to be variable-size automatically, this must be called first. You can
- ** call CLVVariableSizeCells at a later time to utilize this feature, as it
- ** calls CLVInitialize.
- **
- **
- ** A number of developers have expressed a desire to have the List Manager support
- ** variable-size cells. In response to this, the List control has been extended to
- ** support variable-size rows and columns.
- **
- ** The first problem is where to store the size for each row and column. This
- ** implementation expects the sizes for the individual column widths to be stored
- ** in row 0, cells 1 through numCols, and the individual row widths to be stored in
- ** column 0, rows 1 through numRows. The values are placed in the cells in decimal
- ** ascii. (This is so that the AppsToGo editor can easily be used to create lists
- ** with variable-size cells. You just enter the decimal ascii value in the editor.)
- ** Any row or column without a decimal ascii entry for the size will get the regular
- ** size for a cell.
- **
- ** Since row 0 and column 0 are used to store the widths, these cells are not available
- ** in the list. They are not displayed, and you can not scroll into them. Due to this,
- ** the list is one column narrower and one row shorter than a regular list.
- **
- ** The variable-size list expects the dataBounds upper-left to be 0,0. Any other
- ** upper-left for the dataBounds will cause the variable-size list to misbehave.
- ** A dataBounds other than 0,0 is very rare, and unnecessary, so it seemed better
- ** to not have the code to support it, than to code for a feature almost never used.
- **
- ** Bit 14 of the mode field needs to be set to true for the list to be converted to
- ** a variable-size list. Also, CLVInitialize() has to be called at some time, or else
- ** the framework will create the list as a regular list. (Start.c is a good place.)
- **
- ** For the most part, the List control is managed just like the regular List control.
- ** If you need to access the List itself, it is stored in the refCon of the List control.
- ** However, since the List Manager calls aren't expecting the list to be of variable-size
- ** cells, you can't make all of the calls to the List Manager you would normally make.
- **
- ** If you create a regular list, and then place decimal ascii values in row 0 and
- ** column 0 (where needed), you can then directly call CLVVariableSizeCells() for that
- ** list, and it will be converted. (If you call CLVVariableSizeCells() directly, you
- ** don't actually need to call CLVInitialize(), as it does this for you.)
- **
- ** Below are the List Manager calls, and how they should be handled when using a
- ** variable-size list:
- **
- **
- ** LActivate:
- ** Call CLActivate().
- **
- ** LAddColumn:
- ** Call CLVAddColumn().
- **
- ** LAddRow:
- ** Call CLVAddRow().
- **
- ** LAddToCell:
- ** Okay to call. Cell won't be drawn, though. Standard list drawing is disabled
- ** when using variable-size cell mode. Call CLVDraw() afterwards to draw the cell.
- **
- ** LAutoScroll:
- ** Call CLVAutoScroll().
- **
- ** LCellSize:
- ** New meaning. You can set the size of a column or row. To do, do the following:
- ** 1) LGetCell() for the row or column width to change. Example:
- ** For column 3,
- ** short len, locSize[2];
- ** Point cell;
- **
- ** len = 2 * sizeof(short);
- ** cell.h = 3;
- ** cell.v = 0;
- ** LGetCell(locSize, &len, cell, list);
- ** 2) Set the size (2nd word) to new size (locSize[1] = newSize).
- ** 3) LSetCell(locSize, len, cell, list);
- ** 4) CLVAdjustCellLocs(list)
- ** 5) CLVUpdate(list)
- **
- ** LClick:
- ** Call CLVClick().
- **
- ** LClrCell:
- ** Okay to call. Cell won't be drawn, though. Standard list drawing is disabled
- ** when using variable-size cell mode. Call CLVDraw() afterwards to draw the cell.
- **
- ** LDelColumn:
- ** Call LDelColumn(), followed by CLVAdjustCellLocs() and CLVUpdate().
- **
- ** LDelRow:
- ** Call LDelRow(), followed by CLVAdjustCellLocs() and CLVUpdate().
- **
- ** LDispose:
- ** Don't call it. Dispose by DisposeControl(CLViewFromList(list)).
- **
- ** LDoDraw:
- ** Don't call it. The variable-sized control should always have doDraw false.
- ** (You can hide the list by making the control invisible.)
- **
- ** LDraw:
- ** Call CLVDraw().
- **
- ** LFind:
- ** Okay to call.
- **
- ** LGetCell:
- ** Okay to call.
- **
- ** LGetSelect:
- ** Okay to call.
- **
- ** LLastClick:
- ** Okay to call.
- **
- ** LNextCell:
- ** Okay to call.
- **
- ** LRect:
- ** Call CLVGetCellInfo().
- ** It's overkill, since it gets everything, but tough. There aren't too many
- ** occasions for the app to get the cell rect, so I'm not going to have another
- ** call to do it.
- **
- ** LScroll:
- ** Don't call.
- **
- ** LSearch:
- ** Okay to call.
- **
- ** LSetCell:
- ** Okay to call. Cell won't be drawn, though. Standard list drawing is disabled
- ** when using variable-size cell mode. Call CLVDraw() afterwards to draw the cell.
- **
- ** LSetSelect:
- ** Call CLVSetSelect().
- **
- ** LUpdate:
- ** Call CLVUpdate
- */
-
- void CLVVariableSizeCells(ListHandle list);
- /*
- ** ¶ Convert a List control to one that has variable size rows and columns.
- **
- ** INPUT: list List to convert to variable-size cells.
- **
- ** This is called to convert a List control to one that has variable size rows and columns. */
-
- void CLVAdjustScrollBars(ListHandle list);
- /*
- ** ¶ Adjust the scrollbars to reflect new list size.
- **
- ** INPUT: list List whose scrollbars need adjusting.
- **
- ** After doing other operations, call this to adjust the scrollbars to reflect the
- ** the new List size. */
-
- void CLVFindCell(ListHandle list, Point mouseLoc, Point *cell);
- /*
- ** ¶ Given a mouse location, find the cell that contains it.
- **
- ** INPUT: list List to examine.
- ** mouseLoc Point to find the cell for.
- ** OUTPUT: cell Cell containing the mouseLoc point.
- **
- ** Since cells are of variable size, it is more difficult to determine which cell contains
- ** a particular point. CLVFindCell will do this. If in fact the point is not contained by
- ** any cell, -1, -1 is returned. */
-
- void CLVGetCellRect(ListHandle list, short xx, short yy, Rect *cbnds);
- /*
- ** ¶ Given a cell xx,yy, return its bounding rect.
- **
- ** INPUT: list List to get bounding rect for.
- ** xx Column of cell.
- ** yy Row of cell.
- ** OUTPUT: cbnds Bounding rect of cell.
- **
- ** Get the bounding rect of a cell. If that cell is invisible, then the rect returned
- ** will be the empty rect. */
-
- void CLVGetVisCells(ListHandle list, Rect *visRct);
- /*
- ** ¶ Get the bounding rect of the cells visible within the Control's view rect.
- **
- ** INPUT: list List to get visible-area bounding rect for.
- ** OUTPUT: visRct Rect bounding all cells visible within control.
- **
- ** This call is used instead of the visRect field of a list. */
-
- void CLVGetCellInfo(ListHandle list, short xx, short yy, Rect *cbnds, short *cellNum,
- short *select, short *ofst, short *len);
- /*
- ** ¶ Get plenty of information on a particular cell.
- **
- ** INPUT: list List to get info on.
- ** xx Column of cell to get info on.
- ** yy Row of cell to get info on.
- ** OUTPUT: cbnds Bounding rect of cell.
- ** cellNum Number of cell in list.
- ** select True if cell is selected.
- ** ofst Offset into the data area for cell's data.
- ** len Length of cell's data.
- **
- ** This call is really more for the variable-list code. You may find it useful, however. */
-
- void CLVSetSelect(Boolean select, Point cell, ListHandle list);
- /*
- ** ¶ Set the select state for a variable-size cell.
- **
- ** INPUT: select Desired select state (true or false).
- ** cell Cell to set select state for.
- ** list List containing cell to set select state for.
- **
- ** Whenever you have a variable-cell-size list, use this instead of LSetSelect. */
-
- void CLVAutoScroll(ListHandle list);
-
- void CLVAdjustCellLocs(ListHandle list);
-
- short CLVAddColumn(short count, short colNum, short ww, ListHandle list);
- /*
- ** ¶ Add a column to a variable-size cell.
- **
- ** INPUT: short Number of columns to add.
- ** colNum Column number to insert new columns into.
- ** ww Width of new column(s).
- ** list List to add new column(s) to.
- **
- ** Use this instead of LAddColumn. */
-
- short CLVAddRow(short count, short rowNum, short hh, ListHandle list);
- /*
- ** ¶ Add a row to a variable-size cell.
- **
- ** INPUT: short Number of rows to add.
- ** rowNum Row number to insert new columns into.
- ** hh Height of new rows(s).
- ** list List to add new rows(s) to.
- **
- ** Use this instead of LAddRow. */
-
- void CLVDraw(Point cell, ListHandle list);
- /*
- ** ¶ Draw a single variable-size cell.
- **
- ** INPUT: cell Cell to draw.
- ** list List containing cell to draw.
- **
- ** Draw a single variable-size cell. */
-
- Boolean CLVClick(Point mouseLoc, short modifiers, ListHandle list);
- /*
- ** ¶ Handle a mouseDown for a variable-cell-size list control.
- **
- ** INPUT: mouseLoc The click location the list needs to handle.
- ** modifiers Event record
- ** list The list which is to receive the mouse click.
- ** RESULT: Boolean True if user double-clicked on cell.
- **
- ** This is used instead of calling LClick. You probably don't need to call it diretly, as you
- ** would call CLClick or CLEvent. CLClick (and possibly CLEvent) would call this if the list
- ** was a variable-cell-size list. */
-
- void CLVUpdate(RgnHandle clipRgn, ListHandle list);
- /*
- ** ¶ Draw the variable-cell-size list control in the correct mode.
- **
- ** INPUT: clipRgn Draw only within this region.
- ** list List to draw.
- **
- ** Draw the variable-cell-size list control in the correct mode. */
-
- void CLVCallDefProc(short lMessage, short lSelect, Rect *lRect, Cell lCell,
- short lDataOffset, short lDataLen, ListHandle list);
- /*
- ** ¶ Calls the variable-cell-size list's LDEF.
- **
- ** INPUT: clipRgn Draw only within this region.
- ** list List to draw.
- **
- ** Calls the variable-cell-size list's LDEF. */
-
-
- typedef void (*CLActivateProcPtr)(Boolean active, ListHandle listHndl);
- typedef Boolean (*CLClickProcPtr)(WindowPtr window, EventRecord *event, short *action);
- typedef ControlHandle (*CLCtlHitProcPtr)(void);
- typedef ListHandle (*CLFindActiveProcPtr)(WindowPtr window);
- typedef Boolean (*CLKeyProcPtr)(WindowPtr window, EventRecord *event);
- typedef ControlHandle (*CLNextProcPtr)(WindowPtr window, ListHandle *listHndl, ControlHandle ctl, short dir, Boolean justActive);
- typedef ControlHandle (*CLViewFromListProcPtr)(ListHandle listHndl);
- typedef ListHandle (*CLWindActivateProcPtr)(WindowPtr window, Boolean displayIt);
-
- typedef void (*CLVVariableSizeCellsProcPtr)(ListHandle list);
- typedef void (*CLVGetCellRectProcPtr)(ListHandle list, short xx, short yy, Rect *cbnds);
- typedef void (*CLVUpdateProcPtr)(RgnHandle clipRgn, ListHandle list);
- typedef void (*CLVAutoScrollProcPtr)(ListHandle list);
- typedef void (*CLVSetSelectProcPtr)(Boolean select, Point cell, ListHandle list);
- typedef Boolean (*CLVClickProcPtr)(Point mouseLoc, short modifiers, ListHandle list);
- typedef void (*CLVAdjustScrollBarsProcPtr)(ListHandle list);
-
-
- #define rListCtl 4016
-
- #define clHScroll 0x0002
- #define clVScroll 0x0008
- #define clActive 0x0020
- #define clShowActive 0x0040
- #define clKeyPos 0x0080
- #define clTwoStep 0x0100
- #define clHasGrow 0x0200
- #define clVariable 0x4000
- #define clDrawIt 0x8000
-
- #endif
-